package weaver.batchchanges.cmd;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.batchchanges.bean.BatchTasksChangesGlobalData;
import weaver.batchchanges.bean.TaskLedgerPhase2Bean;
import weaver.batchchanges.util.CmdResultUtil;

import java.util.List;


/**
 * 获取任务台账二期表数据的cmd类
 */
public class GetTaskLedgerPhase2DataCmd extends AbstractCommonCommand<List<TaskLedgerPhase2Bean>> {


    @Override
    public BizLogContext getLogContext() {
        return null;
    }

    @Override
    public List<TaskLedgerPhase2Bean> execute(CommandContext commandContext) {
        RecordSet rs = new RecordSet();

        String sql = "select * from "+ BatchTasksChangesGlobalData.TASK_LEDGER_PHASE2_TABLE_NAME;
        // 防止sql注入, objects 为动态参数
        rs.executeQuery(sql);
        List<TaskLedgerPhase2Bean> listMapResult = CmdResultUtil.getResult(rs, TaskLedgerPhase2Bean.class);

        return listMapResult;
    }
}
